# _*_ coding: utf-8
__author__ = 'hb'
__date__ = '2018/11/20 10:41'
import xadmin
from .models import EmailVerifyRecord,Banner
from xadmin import views

class  BaseSetting(object):
        enable_themes = True
        use_bootswatch = True

class GlobalSettings(object):
    site_title = "老周网络学院后台管理系统"
    site_footer = "老周网络学院有限公司"
    menu_style = "accordion"


class EmailVerifyRecordAdmin(object):
    # code = models.CharField('验证码', max_length=20)
    # email = models.EmailField('邮箱', max_length=50)
    # send_type = models.CharField("发送类型",choices=send_choices, max_length=30)
    # send_time = models.DateTimeField("发送时间", default=datetime.now)

    list_display = ['code', 'email', 'send_type', 'send_time']
    search_fields = ['code', 'email', 'send_type']
    # 后台过滤条件
    list_filter = ['code', 'email', 'send_type', 'send_time']
class BannerAdmin(object):
    # title = models.CharField('标题', max_length=100)
    # image = models.ImageField('轮播图', upload_to='banner/%Y%m', max_length=100)
    # url = models.URLField('访问地址', max_length=200)
    # index = models.IntegerField('顺序', default=100)
    # add_time = models.DateTimeField('添加时间', default=datetime.now)

    list_display = ['title', 'image', 'url', 'index', 'add_time']
    search_fields = ['title', 'image', 'url', 'index']
    # 后台过滤条件
    list_filter = ['title', 'image', 'url', 'index', 'add_time']


xadmin.site.register(EmailVerifyRecord, EmailVerifyRecordAdmin)
xadmin.site.register(Banner, BannerAdmin)
xadmin.site.register(views.BaseAdminView, BaseSetting)
xadmin.site.register(views.CommAdminView, GlobalSettings)
